astResolver = $astResolver; $this->nodeTypeResolver = $nodeTypeResolver; $this->constructorAssignDetector = $constructorAssignDetector; $this->nodeNameResolver = $nodeNameResolver; } public function isUnitialized(Expr $expr) : bool { if (!$expr instanceof PropertyFetch && !$expr instanceof StaticPropertyFetch) { return \false; } $varType = $expr instanceof PropertyFetch ? $this->nodeTypeResolver->getType($expr->var) : $this->nodeTypeResolver->getType($expr->class); if ($varType instanceof ThisType) { $varType = $varType->getStaticObjectType(); } if (!$varType instanceof TypeWithClassName) { return \false; } $className = $varType->getClassName(); $classLike = $this->astResolver->resolveClassFromName($className); if (!$classLike instanceof ClassLike) { return \false; } $propertyName = (string) $this->nodeNameResolver->getName($expr); $property = $classLike->getProperty($propertyName); if (!$property instanceof Property) { return \false; } if (\count($property->props) !== 1) { return \false; } if ($property->props[0]->default instanceof Expr) { return \false; } return !$this->constructorAssignDetector->isPropertyAssigned($classLike, $propertyName); } }